/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    font-size: 14px;
    min-height: 100vh;
}

/* 架构设计器容器 */
.architecture-designer {
    display: flex;
    height: calc(100vh - 20px);
    max-height: 900px;
    margin: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 200px;
    background-color: #fff;
    border-right: 1px solid #ddd;
    padding: 10px;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar h2 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 16px;
}

.component-group {
    margin-bottom: 15px;
}

.component-group h3 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.component-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.component {
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    width: calc(50% - 4px);
}

.component-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.component i {
    margin-bottom: 4px;
    font-size: 16px;
}

.user-role-block {
    background-color: #e8f4ff;
    border: 1px dashed #4a7baf;
}

.function-block {
    background-color: #fff8eb;
    border: 1px dashed #ff8d43;
}

.scene-block {
    background-color: #f0f9f1;
    border: 1px dashed #ff8d43;
}

.capability-block {
    background-color: #d4edda;
    border: 1px dashed #25a038;
}

.stats-block {
    background-color: #e9f6ff;
    border: 1px dashed #4a7baf;
}

.support-block {
    background-color: #f3ecf6;
    border: 1px dashed #9c27b0;
}

.component:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 工作区 */
.workspace {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
}

/* 架构行 */
.architecture-row {
    display: flex;
    margin-bottom: 15px;
    position: relative;
    flex-shrink: 0;
}

/* 垂直标签 */
.vertical-label {
    width: 30px;
    background-color: #4a7baf;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px 0 0 4px;
    flex-shrink: 0;
}

.right-label {
    border-radius: 0 4px 4px 0;
}

.label-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 8px 0;
}

.label-content span {
    writing-mode: vertical-lr;
    text-orientation: upright;
    margin: 3px 0;
    font-weight: bold;
    font-size: 12px;
}

/* 模块容器 */
.architecture-modules {
    flex: 1;
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    min-height: 60px;
    justify-content: flex-start;
    transition: all 0.3s ease;
    position: relative;
}

/* 拖拽状态样式 */
.architecture-modules.drag-over {
    background-color: #e8f4ff;
    border: 2px dashed #4a7baf;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.architecture-modules.drag-over::after {
    content: '拖拽到此处';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(74, 123, 175, 0.1);
    color: #4a7baf;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    z-index: 10;
}

.component.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.module.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 拖拽排序指示器 */
.sortable-ghost {
    opacity: 0.3;
    background: #e8f4ff !important;
    border: 2px dashed #4a7baf !important;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
}

.sortable-drag {
    opacity: 0.8;
    transform: rotate(5deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* 拖拽动画 */
.flip-list-move {
    transition: transform 0.3s ease;
}

.module {
    transition: all 0.3s ease;
}

.module:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 用户角色模块 */
.user-role-row {
    min-height: 80px;
    height: auto;
}

.user-role-row .architecture-modules {
    background-color: #e8f4ff;
}

.user-role-module {
    flex: 1;
    min-width: 180px;
    max-width: 250px;
    background-color: #4a7baf;
    color: white;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    position: relative;
}

.user-role-module .module-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.user-role-module .module-header i {
    margin-right: 6px;
}

.user-role-module .module-content {
    font-size: 12px;
    opacity: 0.8;
}

/* 功能模块 */
.function-row {
    min-height: 60px;
    height: auto;
}

.function-row .architecture-modules {
    background-color: #fff8eb;
}

.function-module {
    display: inline-block;
    position: relative;
    flex: 1;
    min-width: 80px;
    max-width: 150px;
}

.tab-item {
    padding: 8px 15px;
    background-color: #ff8d43;
    color: white;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    margin-right: 2px;
    white-space: nowrap;
    text-align: center;
    display: block;
}

.tab-item.active {
    background-color: #ec6b1b;
}

/* 场景模块 */
.scene-row {
    min-height: 150px;
    flex: 1;
}

.scene-row .architecture-modules {
    background-color: #f0f9f1;
}

.scene-container {
    flex: 1;
    display: flex;
}

.scene-modules {
    flex: 1;
}

.scene-module {
    flex: 1;
    min-width: 150px;
    max-width: 220px;
    background-color: #ff8d43;
    border-radius: 4px;
    padding: 8px;
    color: white;
    position: relative;
}

.scene-module .module-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.scene-module .module-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.scene-item {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px;
    border-radius: 3px;
    font-size: 11px;
    text-align: center;
}

/* 统计数据模块 */
.stats-row {
    min-height: 60px;
}

.stats-row .architecture-modules {
    background-color: #e9f6ff;
}

.stats-module {
    display: inline-block;
    position: relative;
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

.stats-item {
    padding: 6px 12px;
    background-color: #4a7baf;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 8px;
    white-space: nowrap;
    text-align: center;
    display: block;
}

/* 能力支撑模块 */
.capability-row {
    min-height: 120px;
}

.capability-row .architecture-modules {
    background-color: #f0f9f1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 10px;
}

.capability-module {
    flex: 1;
    min-width: calc(25% - 12px);
    background-color: #25a038;
    color: white;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    margin-bottom: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.capability-item {
    font-weight: bold;
    padding: 6px 0;
    margin-bottom: 8px;
    font-size: 12px;
}

.logo-area {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 4px;
    padding: 4px;
}

.capability-logo {
    max-height: 30px;
    max-width: 100%;
}

.capability-row .architecture-modules.capability-modules {
    row-gap: 10px;
}

/* 能力支撑第二行 */
.capability-row .architecture-modules.platform-modules {
    background-color: #f5f5f5;
    border-top: none;
    padding-top: 0;
}

/* 基础支持模块 */
.support-row {
    min-height: 60px;
}

.support-row .architecture-modules {
    background-color: #f3ecf6;
}

.support-module {
    display: inline-block;
    position: relative;
    flex: 1;
    min-width: 120px;
    max-width: 220px;
}

.support-item {
    padding: 6px 12px;
    background-color: #9c27b0;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 8px;
    white-space: nowrap;
    text-align: center;
    display: block;
}

/* 模块通用样式 */
.module {
    cursor: move;
    position: relative;
    transition: all 0.2s;
    margin: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.24);
}

.module.active {
    box-shadow: 0 0 0 2px #4caf50, 0 2px 4px rgba(0,0,0,0.2);
}

.module:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.16), 0 2px 4px rgba(0,0,0,0.23);
}

.module-actions {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    gap: 4px;
}

.module-actions button {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    padding: 0;
}

.module-actions button:hover {
    background-color: #f5f5f5;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #666;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.item-row {
    display: flex;
    margin-bottom: 8px;
}

.item-row input {
    flex: 1;
    margin-right: 8px;
}

.remove-button {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    cursor: pointer;
}

.add-button {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-button i {
    margin-right: 5px;
}

.logo-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo-upload-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.upload-button:hover {
    background-color: #0056b3;
}

.logo-preview {
    margin-top: 10px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
    text-align: center;
    position: relative;
}

.logo-preview-img {
    max-width: 100%;
    max-height: 100px;
}

.logo-actions {
    position: absolute;
    top: 5px;
    right: 5px;
}

.clear-logo-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.clear-logo-btn:hover {
    background-color: #c82333;
}

.logo-options {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-options label {
    font-size: 12px;
    color: #666;
}

.logo-options select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

/* 动态Logo尺寸 */
.capability-logo.small {
    width: 20px;
    height: 20px;
}

.capability-logo.medium {
    width: 40px;
    height: 40px;
}

.capability-logo.large {
    width: 60px;
    height: 60px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer button {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.cancel-button {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
}

.save-button {
    background-color: #4caf50;
    border: none;
    color: white;
}

/* 自定义组件样式 */
.custom-block {
    background-color: #f8f9fa;
    border: 1px dashed #6c757d;
}

.plugin-block {
    background-color: #e9ecef;
    border: 1px dashed #6c757d;
}

.custom-row {
    min-height: 60px;
}

.custom-row .architecture-modules {
    background-color: #f8f9fa;
}

.custom-module {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 180px;
    margin: 4px;
}

.custom-item {
    padding: 8px 12px;
    border-radius: 4px;
    color: white;
    text-align: center;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
}

.custom-item i {
    font-size: 16px;
}

/* 插件管理器样式 */
.plugin-manager {
    width: 600px;
    max-width: 95%;
}

.plugin-tabs {
    width: 100%;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-header button {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background-color: #f8f9fa;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-header button.active {
    background-color: #007bff;
    color: white;
    border-bottom-color: #007bff;
}

.tab-content {
    padding: 10px 0;
}

.icon-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-preview {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.icon-preview i {
    font-size: 16px;
    color: #666;
}

.attribute-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.attribute-row input {
    flex: 1;
}

.attribute-row select {
    flex: 0 0 100px;
}

.remove-btn, .add-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.remove-btn {
    background-color: #dc3545;
    color: white;
}

.add-btn {
    background-color: #28a745;
    color: white;
}

.form-actions {
    text-align: center;
    margin-top: 20px;
}

.primary-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.primary-btn:hover {
    background-color: #0056b3;
}

.plugin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plugin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.plugin-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-btn {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
} 